package org.amphiprion.descentv2assistant.entity;

import java.util.Date;
import java.util.UUID;

import android.database.Cursor;

public class EncounterQuest extends Entity implements Comparable<EncounterQuest> {
	public enum QuestWinner {
		NONE, HEROES, OVERLORD
	}

	private String name;
	private String gameId;
	private QuestWinner winner = QuestWinner.NONE;
	private int act;
	private final long creationDate;

	public EncounterQuest() {
		super(UUID.randomUUID().toString());
		creationDate = new Date().getTime();
	}

	public EncounterQuest(Cursor cursor) {
		id = cursor.getString(cursor.getColumnIndex("id"));
		name = cursor.getString(cursor.getColumnIndex("name"));
		gameId = cursor.getString(cursor.getColumnIndex("game_session_id"));
		winner = QuestWinner.values()[cursor.getInt(cursor.getColumnIndex("winner"))];
		act = cursor.getInt(cursor.getColumnIndex("act"));
		creationDate = cursor.getLong(cursor.getColumnIndex("date_creation"));
	}

	public String getGameId() {
		return gameId;
	}

	public void setGameId(String gameId) {
		this.gameId = gameId;
	}

	@Override
	public int compareTo(EncounterQuest another) {
		return name.compareTo(another.getName());
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public QuestWinner getWinner() {
		return winner;
	}

	public int getAct() {
		return act;
	}

	public void setAct(int act) {
		this.act = act;
	}

	public void setWinner(QuestWinner winner) {
		this.winner = winner;
	}

	public long getCreationDate() {
		return creationDate;
	}

}
